package com.huangliusong.threadcurrency.example.syncContainer;

import lombok.extern.slf4j.Slf4j;

import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;

/**
 * @author huangliusong
 * @since 2018/11/20
 * {@link }
 */
@Slf4j
public class VectorExample2 {
    private static Vector<Integer> vector=new Vector<>();

    public static void main(String[] args) {
        for (int i=0;i<10;i++){
            vector.add(i);
        }

       Thread thread=new Thread(){
           @Override
           public void run() {
               for (int i=0;i<10;i++){
                   vector.remove(i);
               }
           }
       };

        Thread thread1=new Thread(){
            @Override
            public void run() {
                for (int i=0;i<10;i++){
                    vector.remove(i);
                }
            }
        };

        thread1.start();
        thread.start();
    }
}
